# 方法1
a = input(":")
b = input(":")
c = []
d = []
e = []

for i in range(1, int(a)+1):
    if int(a) % i == 0:
        c.append(i)

for i in range(1, int(b)+1):
    if int(b) % i == 0:
        d.append(i)

for i in c:
    for u in d:
        if i == u:
            e.append(i)

print(f"最大公约数为{max(e)}")

# 方法2
def func1(a, b):
    if a == b:
        return a
    num = min(a, b)
    while a % num != 0 or b % num != 0:
        num -= 1
    return num

print(func1(12, 25))

# 方法3
def func2(a, b):
    while b != 0:
        a, b = b, a % b  # ?
    return a

print(func2(148, 42))



